home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
hideac1r
/
search.frm
next >
Wrap
Text File
|
1999-08-18
|
6KB
|
196 lines
VERSION 5.00
Object = "{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}#1.1#0"; "SHDOCVW.DLL"
Begin VB.Form frmSearch
BorderStyle = 3 'Fixed Dialog
Caption = "Search..."
ClientHeight = 5775
ClientLeft = 45
ClientTop = 330
ClientWidth = 7800
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5775
ScaleWidth = 7800
ShowInTaskbar = 0 'False
StartUpPosition = 2 'CenterScreen
Begin VB.ComboBox cmbEngine
Height = 315
Left = 240
Style = 2 'Dropdown List
TabIndex = 6
Top = 5280
Width = 2775
End
Begin VB.CommandButton Command4
Caption = "Stop Search"
Height = 375
Left = 6480
TabIndex = 5
Top = 120
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "Exit"
Height = 375
Left = 6240
TabIndex = 4
Top = 5250
Width = 1335
End
Begin VB.Frame Frame1
Caption = "Web Browser"
Height = 4335
Left = 120
TabIndex = 2
Top = 600
Width = 7575
Begin SHDocVwCtl.WebBrowser WebBrowser1
Height = 3735
Left = 240
TabIndex = 3
Top = 360
Width = 7095
ExtentX = 12515
ExtentY = 6588
ViewMode = 1
Offline = 0
Silent = 0
RegisterAsBrowser= 0
RegisterAsDropTarget= 1
AutoArrange = -1 'True
NoClientEdge = 0 'False
AlignLeft = 0 'False
ViewID = "{0057D0E0-3573-11CF-AE69-08002B2E1262}"
Location = "about:NavigationCanceled"
End
End
Begin VB.TextBox Text1
Height = 285
Left = 1920
TabIndex = 1
Top = 165
Width = 4335
End
Begin VB.CommandButton Command1
Caption = "Search..."
Height = 375
Left = 120
TabIndex = 0
Top = 120
Width = 1575
End
Begin VB.Label Label1
Caption = "Search Engines"
Height = 255
Left = 240
TabIndex = 7
Top = 5040
Width = 1815
End
End
Attribute VB_Name = "frmSearch"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Const WEBCRAWLER = "WebCrawler"
Private Const ALTAVISTA = "AltaVista"
Private Const YAHOOCOM = "Yahoo.com"
Private Const YAHOOCOUK = "Yahoo.co.uk"
Private Const HOTBOT = "HotBot"
Private Sub cmbEngine_Click()
'Change some bits and pieces on the form to let the user know where they are browsing...
With Me
Select Case .cmbEngine.Text
Case "AltaVista"
.Command1.Caption = "Search Altavista"
.Frame1.Caption = "Browse AltaVista"
Case "HotBot"
.Command1.Caption = "Search HotBot"
.Frame1.Caption = "Browse HotBot"
Case "Yahoo.com"
.Command1.Caption = "Search Yahoo"
.Frame1.Caption = "Browse Yahoo"
Case "Yahoo.co.uk"
.Command1.Caption = "Search Yahoo UK"
.Frame1.Caption = "Browse Yahoo UK"
Case "WebCrawler"
.Command1.Caption = "Search WebCrawler"
.Frame1.Caption = "Browse WebCrawler"
Case Else
MsgBox "Error detected in selecting search Engine"
End Select
End With
End Sub
Private Sub Command1_Click()
Dim searchURL As String
With Me
'Check for empty search string
If .Text1.Text = "" Then
MsgBox "Please select a keyword(s) to search for"
Exit Sub
End If
'Check for no search engine selected
If .cmbEngine.Text = "" Then
MsgBox "Please select your preferred Search Engine"
Exit Sub
End If
Select Case .cmbEngine.Text
Case "AltaVista"
searchURL = "http://www.altavista.com/cgi-bin/query?q=" & .Text1.Text
Case "HotBot"
searchURL = "http://www.hotbot.com/?MT=" & .Text1.Text
Case "Yahoo.com"
searchURL = "http://search.yahoo.com/bin/search?p=" & Text1.Text
Case "Yahoo.co.uk"
searchURL = "http://search.yahoo.co.uk/search/ukie?p=" & .Text1.Text
Case "WebCrawler"
searchURL = "http://www.webcrawler.com/cgi-bin/WebQuery?searchText=" & .Text1.Text
Case Else
MsgBox "Error detected in selecting search Engine"
End Select
End With
'Navigate to the selected search engine and keyword
WebBrowser1.Navigate searchURL
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Command4_Click()
WebBrowser1.Stop
End Sub
Private Sub Form_Load()
Dim sURL As String
With Me
'Assign a default URL to the WebBrowser control or it errors
sURL = "http://www.yahoo.com"
.WebBrowser1.Navigate sURL
'Add items to search engine dropdown box
.cmbEngine.AddItem ALTAVISTA
.cmbEngine.AddItem HOTBOT
.cmbEngine.AddItem WEBCRAWLER
.cmbEngine.AddItem YAHOOCOM
.cmbEngine.AddItem YAHOOCOUK
'Reset form captions
.Command1.Caption = "Search"
.Frame1.Caption = "Browse"
End With
End Sub